Below is a PHP function that validates an email address and returns the result as a boolean. This function uses the PHP built-in function filter_var
and the filter FILTER_VALIDATE_EMAIL
<?php //php 7.0.8 function ValidateEmail($email) { $email = 'myEmail@myDomain.com'; $isValid = filter_var($email, FILTER_VALIDATE_EMAIL); if ($isValid) { return true; } else { return false; } } ?>
Easy isn’t?